// 用户模块
import {actionType} from '../action'
export const initialState = {
    age: 18,
    name: 'Tom'
}

const userReducer = (state = initialState, action) => {
    console.log(state, action);
    switch (action.type) {

        case actionType.CHANGEAGE:
            return {
                ...state,
                age: state.age + 1
            }

        case actionType.CHANGENAME:
            return {
                ...state,
                name: action.val
            }

        default:
            return state
    }
}

export default userReducer